#coding = utf-8
import socket
import sys
reload(sys)
sys.setdefaultencoding('utf8')


host = '127.0.0.1'
mport = input('my port:')
yport = input('your port:')

udpsock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

udpsock.bind((host,mport))

while True:
    words = raw_input("mywords:")
    if not words:
        break
    udpsock.sendto(words,(host, yport))
    data,addr=udpsock.recvfrom(1024)
    print data
udpsock.close()   
print 'exit'

